Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Product.php #1

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open

Update Product.php #1

wants to merge 2 commits into from

Conversation

Shoprunners
Copy link
Owner

Questions Answers
Branch? develop
Description? Make it possible to create a product via webservice in an empty category
Type? bug fix
Category? WS
BC breaks? no
Deprecations? no
Fixed ticket? Fixes PrestaShop#14903
Related PRs
How to test? Follow the instructions in the ussue
Possible impacts? unknown

classes/Product.php Outdated Show resolved Hide resolved
@@ -7087,7 +7087,9 @@ public function setWsPositionInCategory($position)
// result is indexed by recordset order and not position. positions start at index 1 so we need an empty element
array_unshift($result, null);
foreach ($result as &$value) {
$value = $value['id_product'];
if($value != null) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just move the array unshift after the foreach would avoid getting for logic in here

Performance improvement of checking valid position by counting the resultset only once
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot add a position_in_category using webservices
2 participants